'use strict';
const db = uniCloud.database();
exports.main = async (event, context) => {
	const data = event.data
	const street = data.street
	const res = await db.collection('addresses').where({street}).get()
	if(res.data.length === 0) {
		const resData = await db.collection('addresses').add(data)
		return {
			status: 0,
			msg: '添加成功'
		}
	}
	return {
		status: -1,
		msg: '地址已存在'
	}
};
